package com.kitty.game.task.service.taskHandler;

import com.kitty.common.utils.SpringUtils;
import com.kitty.game.task.model.product.TaskType;

import java.util.HashMap;
import java.util.Map;

public enum TaskHelper {
    INSTANCE;

    private static final Map<TaskType, TaskHandler> handlers = new HashMap<>();

    public void init(TaskType taskType, TaskHandler taskHandler) {
        handlers.put(taskType, taskHandler);
    }

    public TaskHandler getTaskHandler(TaskType taskType) {
        return handlers.get(taskType);
    }

    public Map<TaskType, TaskHandler> getHandlers() {
        return handlers;
    }

    static {
        /**主线*/
        INSTANCE.init(TaskType.MAIN_LINE, SpringUtils.getBean(MainTaskHandler.class));
        /**师门*/
        INSTANCE.init(TaskType.SCHOOL, SpringUtils.getBean(SchoolTaskHandler.class));
        /**白帮忙*/
        INSTANCE.init(TaskType.HELP_PEOPLE, SpringUtils.getBean(HelpPeopleTaskHandler.class));
        /**挖宝*/
        INSTANCE.init(TaskType.DIG_TREASURE, SpringUtils.getBean(DigTreasureTaskHandler.class));
        /**天神护佑*/
        INSTANCE.init(TaskType.GOD_PROTECT, SpringUtils.getBean(GodProtectTaskHandler.class));
        /**变身卡*/
        INSTANCE.init(TaskType.CHANGE_CARD, SpringUtils.getBean(ChangeCardTaskHandler.class));
        /**九曲玲珑笔*/
        INSTANCE.init(TaskType.SHAPE_PEN, SpringUtils.getBean(ShapePenTaskTaskHandler.class));
        /**宠物飞升*/
        INSTANCE.init(TaskType.PET_FLY, SpringUtils.getBean(PetFlyTaskHandler.class));
        /**强制PK*/
        INSTANCE.init(TaskType.FORCE_PK, SpringUtils.getBean(ForcePkTaskHandler.class));
        /**副本*/
        INSTANCE.init(TaskType.DUGEON, SpringUtils.getBean(DugeonTaskHandler.class));
        /**试道大会*/
        INSTANCE.init(TaskType.SHIDAO, SpringUtils.getBean(ShiDaoTaskHandler.class));
        /**人物飞升*/
        INSTANCE.init(TaskType.ROLE_FLY, SpringUtils.getBean(RoleFlyTaskHandler.class));
        /**积分*/
        INSTANCE.init(TaskType.SCORE, SpringUtils.getBean(RechargeScoreTaskHandler.class));
        /**阵营指引*/
        INSTANCE.init(TaskType.CAMP_GUIDE, SpringUtils.getBean(CampGuideTaskHandler.class));
        /**人物证道1*/
        INSTANCE.init(TaskType.ROLE_ZHENGDAO, SpringUtils.getBean(RoleZhengDaoTaskHandler.class));
        /**萝卜桃子*/
        INSTANCE.init(TaskType.luobotaozi, SpringUtils.getBean(LuobotaoziTaskHandler.class));
        //押镖
        INSTANCE.init(TaskType.YABIAO, SpringUtils.getBean(YaBiaoTaskHandler.class));

    }
}
